package com.jwm.power.repository;

import com.jwm.power.model.entity.Workordertypes;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;
public interface WorkordertypesRepository extends JpaRepository<Workordertypes, Integer>, JpaSpecificationExecutor<Workordertypes> {
    Workordertypes findByTid(@Param("tid") Integer tid);
    List<Workordertypes> findByTname(@Param("tname") String tname);
    List<Workordertypes> findByTnameAndTidNot(@Param("tname") String tname,@Param("tid") Integer tid);
    //  获取最大编码
    @Query(value = "select top 1 RIGHT(TCode,2) from Workordertypes   order by TCode DESC ", nativeQuery = true)
    String getMaxCode();
}
